#include <stdio.h>
#include <stdlib.h>

int* returnSimplifiedDiv(int son, int mother) {
    int signal = (son >= 0) ^ (mother > 0);
    for (int i = 2; i <= abs(son); i++) {
        if (abs(son) % i == 0 && abs(mother) % i == 0) {
            return returnSimplifiedDiv(!signal ? abs(son) / i : -abs(son) / i, abs(mother) / i);
        }
    }
    static int result[2];
    result[0] = !signal ? abs(son) : -abs(son);
    result[1] = abs(mother);
    return result;
    // 需要特别考虑负数的情况~
}

int main() {
    int son1, mother1, son2, mother2;
    scanf("%d/%d", &son1, &mother1);
    scanf("%d/%d", &son2, &mother2); // 格式化输入
    int* result = returnSimplifiedDiv(son1 * mother2 + son2 * mother1, mother1 * mother2);
    printf("(%d/%d)+(%d/%d)=%d/%d\n", son1, mother1, son2, mother2, result[0], result[1]);
    // 加上
    result = returnSimplifiedDiv(son1 * mother2 - son2 * mother1, mother1 * mother2);
    printf("(%d/%d)-(%d/%d)=%d/%d\n", son1, mother1, son2, mother2, result[0], result[1]);
    // 减去
    result = returnSimplifiedDiv(son1 * son2, mother1 * mother2);
    printf("(%d/%d)*(%d/%d)=%d/%d\n", son1, mother1, son2, mother2, result[0], result[1]);
    // 乘上
    result = returnSimplifiedDiv(son1 * mother2, son2 * mother1);
    printf("(%d/%d)/(%d/%d)=%d/%d\n", son1, mother1, son2, mother2, result[0], result[1]);
    // 除去
    return 0;
}